package com.hk.patterntrains.oberverpattern.typeone;

public class CurrentConditionDisplay implements Observer,DisplayElement {
    private float temp;
    private float humidity;
    private float pressure;

    private Subject subject;

    @Override
    public void display() {
        System.out.println(toString());
    }

    @Override
    public void update(float temp, float humidity, float pressure) {
        this.temp = temp;
        this.humidity = humidity;
        this.pressure = pressure;
        display();
    }

    @Override
    public void setSubject(Subject subject) {
        this.subject = subject;
    }

    @Override
    public String toString() {
        return "CurrentConditionDisplay{" +
                "temp=" + temp +
                ", humidity=" + humidity +
                ", pressure=" + pressure +
                '}';
    }
}
